package com.cx.service.impl;

import com.cx.mapper.AdminMapper;
import com.cx.pojo.Admin;
import com.cx.service.AdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class AdminServiceImpl implements AdminService {
    @Autowired
    AdminMapper adminMapper;

    @Override
    public String login(Admin admin) {
        if (admin.getAdminName() == null || admin.getAdminPwd() == null) {
            return "管理员不存在";
        }
        //校验该用户
        Admin adminCheck = adminMapper.selectByAdmin(admin);
        if (adminCheck != null) {
            String adminStr = adminCheck.getId() + ":" + adminCheck.getAdminName();
            return adminStr;
        } else {
            return "管理员不存在";
        }
    }
}
